import cv2
img = cv2.imread('machinelearning.png',1)
cv2.imshow('Machine Learning',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
There are a lot of steps involved in rotating an image. The 2 main functions used here are –
getRotationMatrix2D() : It takes 3 arguments
warpAffine()
import cv2
img = cv2.imread('machinelearning.png',1)
h,w = img.shape[:2]
center = (w // 2, h // 2)
matrix = cv2.getRotationMatrix2D(center, 45, 0.5)
rotated = cv2.warpAffine(img, matrix, (w, h))
cv2.imshow('Machine Learning',rotated)
cv2.waitKey(0)
cv2.destroyAllWindows()